<?php
require_once 'includes/haut.php';
acces($niveau,0);

require_once 'includes/donneesFormulaires.php'; 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>
			Mes favoris
		</title>
		<?php include('includes/headLinks.php');?>
	<script src="plugin/jquery.bxSlider/jquery.bxSlider.min.js" type="text/javascript"></script>
	<script src="js/vitrine.js" type="text/javascript"></script>
	</head>
	<body>

		<div id="entete">
		</div>
	
		<div id="navigation">
			<?php include('includes/navigation.php'); ?>
		</div>

		<div id="principal">
			<h2>Mes Favoris</h2>

			<?php 
			
			$idClient = $client->getId();
			$req = favori::getFavorisById($idClient);
			$i=1;
			while ($res = $req->fetch()){
				$idCreation = $res['idCreation'];
				$creation = creation::getCreationById($idCreation);
				if ($creation!=null) {
					$reqPhotos = photo::getPhotoByCreation($idCreation);
					if ($reqPhotos->rowCount()>0) {
					?>	
					<div id="<?php echo $idCreation;?>" class="prefix_1 listeCreations suffix_1"
						style="margin-bottom: 30px; margin-top: 20px">
						<div class="slider">
							<ul id="slider<?php echo $i;?>">
								<li>							
									<?php
									$j = -1;
									while ($resPhotos = $reqPhotos->fetch()){
	// 									premiere page avec infos
										if ($j < 0) { ?>
											<div class="left">
												<img class="photo" src="images/creations/<?php echo($idCreation.'/'.$resPhotos['nom']);?>" />
											</div>
											<div class="right">
												<div class="album">
													<?php echo $creation['modele']; ?></br>
													<?php  if ($creation['description']!="") echo $creation['description']."</br>"; ?>
													<?php if ($creation['taille']!="")  echo "Taille : ".$creation['taille']."</br>"; ?>
													<?php echo $creation['prix']; ?>&euro;</br>
													<?php echo $creation['dispo']; ?> mod&egrave;les disponibles</br>
												</div>
												<div class="band">
													<span class="supprFavori" data-id="<?php echo $res['id'];?>">Retirer des favoris</span>
												</div>
											</div>
											
											</li><li>
													
										<?php } else{
		// 									pages suivantes avec 3 photos
											if ($j % 3 == 0 && $j > 0) {?>
												</li><li>
											<?php } ?>
											<div class="elementSlider">
												<img class="photo" src="images/creations/<?php echo($idCreation.'/'.$resPhotos['nom']);?>"  />
											</div> 
										<?php }
							 			$j++;
						 			} 
						 			$reqPhotos->closeCursor();?>
								</li>
							</ul>
						</div>
					</div>
					<?php 
					}
				}
				$i++;
			} $req->closeCursor();?>

		</div>
		</div>
		<div id="form_connexion">
			<?php include('includes/formConnexion.php'); ?>
		</div>
	</body>
</html>